package objects;

import java.util.Calendar;

import soundThreads.SoundThread;

public class AlarmMakingNoise extends AlarmState implements Runnable {

	SoundThread soundThread;

	@Override
	public AlarmState stop() {
		// We set up the next time...
		timeSet.set(Calendar.DAY_OF_YEAR, timeSet.get(Calendar.DAY_OF_YEAR) + 1);
		// ...and reset the alarm.
		alarmSet.alarmOn(timeSet);
		// We have no way of knowing whether we were snoozing or not, so there,
		// just in case.
		alarmSnoozing.exit();
		return alarmSet;
	}

	public AlarmState snooze(int timeLapse) {
		return alarmSnoozing.snooze(timeLapse);
	}

	@Override
	public void run() {
		alarmSnoozing.init();
		new Thread(soundThread = new SoundThread(buzz)).run();
	}
}
